package bl.history;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;

import server.boot.ServiceLoader;
import vo.销售明细vo;
import client.boot.BLServiceManager;
import blservice.history.SaleLogBLService;
import db.Database;
import dbservice.history.SaleLogDBService;

public class SaleLogBLDriver {

	SaleLogDBService db;
	SaleLogBLService bl;
	
	public static void main(String[] args) throws MalformedURLException, RemoteException, NotBoundException, SQLException, AlreadyBoundException{
		SaleLogBLDriver d=new SaleLogBLDriver();
		d.drive();
	}
	
	void drive() throws MalformedURLException, RemoteException, NotBoundException, SQLException, AlreadyBoundException{
		Database.iniDatabase("localhost", 3306, "seac2", "seac2", "seac2");
		ServiceLoader.iniServiceLoader();
		BLServiceManager.setServerIP("localhost");
		bl=BLServiceManager.getSaleLogBLService(null);
		
		List<销售明细vo> vo=bl.get();
		for(销售明细vo o:vo){
			System.out.println(o.get时间());
			System.out.println(o.get商品名());
			System.out.println(o.get型号());
			System.out.println(o.get单价());
			System.out.println(o.get数量());
			System.out.println(o.get总额());
		}
		销售明细vo from=new 销售明细vo();
		from.set时间(0);
		销售明细vo to=new 销售明细vo();
		to.set时间(new Date().getTime());
		vo=bl.get(from, to);
		for(销售明细vo o:vo){
			System.out.println(o.get时间());
			System.out.println(o.get商品名());
			System.out.println(o.get型号());
			System.out.println(o.get单价());
			System.out.println(o.get数量());
			System.out.println(o.get总额());
		}
		System.exit(0);
	}
}
